1 from oxsConfig
import ttk
, W
, E
, fCurrent
, currentPinVar
, currentExist
, currentMvoltAt0Var
, currentMvoltPerAmpVar
,\
2 currentRcVar
, currentRgVar
, voltReferenceVar
, voltRefValueVar
4 #from oxsVoltage import voltReferenceChangedInCurrent
6 #here start the definition of the current tab
7 #define PIN_CURRENTSENSOR 2
8 #define MVOLT_AT_ZERO_AMP 600
9 #define MVOLT_PER_AMP 60
10 #define RESISTOR_TO_GROUND_FOR_CURRENT 10
11 #define RESISTOR_TO_CURRENT_SENSOR 40
12 ttk
.Label(fCurrent
, text
="Analog pin" ).grid(column
= 0, row
=1, padx
= (15,5), pady
=25 , sticky
=(E
))
13 ttk
.Label(fCurrent
, text
="mVolt at 0 Amp" ).grid(column
= 0, row
=2, padx
= (15,5), pady
=5 , sticky
=(E
))
14 ttk
.Label(fCurrent
, text
="mVolt per Amp" ).grid(column
= 0, row
=3, padx
= (15,5), pady
=5 , sticky
=(E
))
15 ttk
.Label(fCurrent
, text
="R to ground" ).grid(column
= 0, row
=4, padx
= (15,5), pady
=5 , sticky
=(E
))
16 ttk
.Label(fCurrent
, text
="R to current sensor" ).grid(column
= 0, row
=5, padx
= (15,5), pady
=5 , sticky
=(E
))
18 currentPinBox
= ttk
.Combobox(fCurrent
, textvariable
=currentPinVar
,
19 values
=('0', "1" , "2" , "3" , "4", "5" , "6", "7"),
20 state
="readonly", width
=1)
21 currentPinBox
.grid(column
=1 , row
=1)
23 currentMvoltAt0Box
= ttk
.Entry(fCurrent
, textvariable
=currentMvoltAt0Var
, width
='5')
24 currentMvoltAt0Box
.grid(column
=1 , row
=2)
26 currentMvoltPerAmpBox
= ttk
.Entry(fCurrent
, textvariable
=currentMvoltPerAmpVar
, width
='5')
27 currentMvoltPerAmpBox
.grid(column
=1 , row
=3)
29 currentRgBox
= ttk
.Entry(fCurrent
, textvariable
=currentRgVar
, width
='5')
30 currentRgBox
.grid(column
=1 , row
=4)
32 currentRcBox
= ttk
.Entry(fCurrent
, textvariable
=currentRcVar
, width
='5')
33 currentRcBox
.grid(column
=1 , row
=5)
35 def voltReferenceChanged():
36 from oxsVoltage
import voltReferenceChangedInCurrent
37 voltReferenceChangedInCurrent()
38 #if voltReferenceVar.get()=='Vcc' or voltReferenceVar.get()=='External':
39 # voltRefValueCurrentBox['state']='normal'
40 #voltRefValueVoltageBox['state']='normal'
41 # voltRefValueCurrentLabel['state']='normal'
42 #voltRefValueVoltageLabel['state']='normal'
44 # voltRefValueCurrentBox['state']='disabled'
45 #voltRefValueVoltageBox['state']='disabled'
46 # voltRefValueCurrentLabel['state']='disabled'
47 #voltRefValueVoltageLabel['state']='disabled'
50 ttk
.Label(fCurrent
, text
="Reference for voltage measurements"
51 ).grid(column
= 0, row
=10, padx
= 5, pady
=(30,2), columnspan
= '5' )
52 ttk
.Radiobutton(fCurrent
, variable
=voltReferenceVar
, text
='Internal' , value
='Internal',
53 command
=voltReferenceChanged
).grid(column
=0, row
=11, sticky
=(W
,E
), padx
=20 , pady
=2 , columnspan
= 5)
54 ttk
.Radiobutton(fCurrent
, variable
=voltReferenceVar
, text
='External' , value
='External',
55 command
=voltReferenceChanged
).grid(column
=0, row
=12, sticky
=(W
,E
), padx
=20, pady
=2 , columnspan
= 5)
56 ttk
.Radiobutton(fCurrent
, variable
=voltReferenceVar
, text
='Vcc' , value
='Vcc',
57 command
=voltReferenceChanged
).grid(column
=0, row
=13, sticky
=(W
,E
), padx
=20, pady
=2 , columnspan
= 5)
59 voltRefValueCurrentLabel
= ttk
.Label(fCurrent
, text
="External or Vcc voltage (in mVolt)", state
='disabled' )
60 voltRefValueCurrentLabel
.grid(column
= 1, row
=13, sticky
=(E
) ,padx
= (5,0), pady
=2, columnspan
= '2' )
61 voltRefValueCurrentBox
= ttk
.Entry(fCurrent
, textvariable
=voltRefValueVar
, width
='5' , state
='disabled')
62 voltRefValueCurrentBox
.grid( column
=3, row
=13, sticky
=(W
,E
), padx
=20, pady
=2 )